package com.mvvm.ktnet.ui.testViewPager2

import android.os.Bundle
import android.util.Log
import androidx.activity.OnBackPressedCallback
import com.mvvm.ktnet.R
import com.mvvm.ktnet.base.myappbase.BaseDbFragment
import com.mvvm.ktnet.base.viewmodel.BaseViewModel
import com.mvvm.ktnet.databinding.FmTestViewpager2Binding

class TestViewPager2Fragment : BaseDbFragment<ViewPager2ViewModel, FmTestViewpager2Binding>() {
    override fun layoutId(): Int = R.layout.fm_test_viewpager2

    override fun lazyLoadData() {
        Log.e("测试", "lazyLoadData: ssss1111")

    }

    fun refresh(){}

    override fun initView(savedInstanceState: Bundle?) {

        Log.e("测试", "init: ssss1111")



        if (mViewModel.getTimeSave()==-1L) {

            mDatabind.test.text = "第一次加载"
            mViewModel.setTimeSave(System.currentTimeMillis())
            mViewModel.time = System.currentTimeMillis()
        } else {
            mDatabind.test.text = "上次的值 ${mViewModel.getTimeSave()}"
        }


//        if (mViewModel.time == 0L) {
//
//            mDatabind.test.text = "第一次加载"
//            mViewModel.time = System.currentTimeMillis()
//        } else {
//            mDatabind.test.text = "上次的值 ${mViewModel.time}"
//        }

    }

    override fun createObserver() {

    }

    override fun initDataBind() {

    }

    override fun initData() {

    }

    override fun onDestroyView() {
        super.onDestroyView()
        Log.e("测试", "onDestroyView: ssss")
    }
}